﻿#define _CRT_SECURE_NO_WARNINGS//模拟实现strcmp
#include<stdio.h>
#include<string.h>
my_strcmp(char* p1, char* p2)
{
	while (*p1 == *p2)
	{
		if (*p1 != '\0' && *p2 != '\0')
		{
			p1++;
			p2++;
		}
		else
			break;
	}
	if (*p2 > *p1)
	{
		return -1;
	}
	if (*p2 < *p1)
	{
		return 1;
	}
	return 0;
}
int main()
{
	char* arr1 = "abadn";
	char* arr2 = "abadn";
	int ret = strcmp(arr1, arr2);
	printf("%d\n", ret);
	int ret2 = my_strcmp(arr1, arr2);
	printf("%d\n", ret2);
	return 0;
}